import random
import matplotlib.pyplot as plt

def generate_random(mode = "int(10)"):
        
    if mode == "int(10)":  # 生成1-10的随机整数
        random_num = random.randint(1, 10)
        return random_num


def on_closing(root):
    # 关闭主窗口的时候确保Matplotlib一起关闭
    plt.close('all')
    root.destroy()